/*
 * PANEDocument.cpp
 *
 *  Created on: Apr 19, 2009
 *      Author: wrice
 */

#include "PANEImp.h"
namespace PANEImp {

PANEDocument::PANEDocument()
{
}

Element * PANEDocument::createElement( DOMString tagName ) throw(DOMExceptionPtr) {
	ElementImp * rst = createPANEElement( tagName );
	if( NULL != rst ) return rst;

	return this->DocumentImp::createElement( tagName );
}

PANEElement * PANEDocument::createPANEElement( DOMString tagName ) throw(DOMExceptionPtr) {
	if( tagName == PANEImageElement::TagName ) return createPANEImageElement();
	if( tagName == PANEButtonElement::TagName ) return createPANEButtonElement();
	if( tagName == PANEDivElement::TagName ) return createPANEDivElement();
	if( tagName == PANERadioElement::TagName ) return createPANERadioElement();
	if( tagName == PANEImageBoardElement::TagName ) return createPANEImageBoardElement();
	return NULL;
}

PANEImageElement * PANEDocument::createPANEImageElement() {
	PANEImageElement * elem = new PANEImageElement( this );
	paneElements_.push_back( elem );
	return elem;
}

PANEButtonElement * PANEDocument::createPANEButtonElement() {
	PANEButtonElement * elem = new PANEButtonElement( this );
	paneElements_.push_back( elem );
	return elem;
}

PANEDivElement * PANEDocument::createPANEDivElement() {
	PANEDivElement * elem = new PANEDivElement( this );
	paneElements_.push_back( elem );
	return elem;
}

PANERadioElement * PANEDocument::createPANERadioElement() {
	PANERadioElement * elem = new PANERadioElement( this );
	paneElements_.push_back( elem );
	return elem;
}

PANEImageBoardElement * PANEDocument::createPANEImageBoardElement() {
	PANEImageBoardElement * elem = new PANEImageBoardElement( this );
	paneElements_.push_back( elem );
	return elem;
}


AbstractView * PANEDocument::getDefaultView() {
	// TODO
	return NULL;
}

DOMString PANEDocument::getTitle() {
	return title_;
}

void PANEDocument::setTitle(DOMString title) {
	title_ = title;
}

}
